function defineReactive(data, key, val) {
    observe(val);
    Object.defineProperty(data, key, {
        enumerable: true,
        configurable: true,
        get: function() {
            return val;
        },
        set: function(newVal) {
            val = newVal;
            console.log('属性'+ key +'已被监听，现在值为:"' + newVal.toString() + '"');
        }
    })
}

function observe(data) {
    if (!data || typeof data !== 'object') {
        return;
    }
    Object.keys(data).forEach(function(key) {
        defineReactive(data, key, data[key]);
    });
}
var libs = {
    book1: {
        name: ''
    },
    book2: ''
}
observe(libs);
libs.book1.name = "权威指南";
libs.book2 = '没有此书籍';